package cn.itsource.pojo.dto;

import cn.itsource.pojo.domain.Order;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;

/**
 * @program fccar_tt
 * @Description
 * @Author TT
 * @Date 2024/09/20 18:33
 * @Version 1.0
 */
@Data
public class OrderDto {

    @NotEmpty(message = "不能为空")
    private String carPlate;
    @NotEmpty(message = "不能为空")
    private String carType;

    //起始位置名称、经纬度
    private String startPlace;
    private String startPlaceLatitude;
    private String startPlaceLongitude;

    //终点位置名称、经纬度
    private String endPlace;
    private String endPlaceLongitude;
    private String endPlaceLatiude;

    private Integer expectMinutes;//预计时长
    private BigDecimal expectsMileage;//预计公里数
    //顾客的打赏
    private BigDecimal favourAmount;

    /**
     * 将orderDto里面的字段赋值给order
     * */
    public static Order orderDtoToOrder(OrderDto orderDto){
        Order order = new Order();
        //作用  将orderDto 里面所有字段 和 order 里面对应(字段名和类型必须一致)的字段才能赋值
        BeanUtils.copyProperties(orderDto,order);
        return order;
    }
}
